<? 
	include('base.php');
	User::protect();
	include_class('band_members');


	if ($_POST['submit']) { 
		// add news entry
		$bm = BandMember::add($_POST);				
		if (!db::isError($bm)) {
			header('Location: band_member_edit.php?id=' . $bm->getID());
			exit;
		}
	}
	$calendar = true;
	$section = 'band_members';
	$editors = array('equipment', 'influences','bio');
	$page_title = 'Add Band Member';
	include('layout/header.php');
?>

<div id="breadcrumb">
	<a href="index.php">Audition&nbsp;&#62;</a>&nbsp;<a href="band.php">Manage&nbsp;Band&nbsp;&#62;</a>&nbsp;<a href="band_members.php">Band Members&nbsp;&#62;</a>&nbsp;Add Band Member
</div>

<? if (!User::isAdmin()) {

	$bm->outputDialog('Return to Band Members','band_members.php', 'You may not add a band member.');
	
} else {

	if (db::isError($bm)) {
		$bm->outputList();
	}
	
	?>	
	
		
	<h1>add band member:</h1>
	<div class="inset">
	<form id="edit_entry" action="<?=$PHP_SELF?>" method="post">
	<table border="0" cellspacing="0" cellpadding="0" class="edit-form">
	<tr>
		<td width="50%"><strong>Username</strong><br/><input type="text" name="username" value="<?=$_POST['username']?>" class="text"></td>
		<td width="50%"><strong>Email Address</strong><br/><input type="text" name="email" value="<?=$_POST['email']?>" class="text"></td>
	</tr>
	<tr>
		<td width="50%"><strong>Password</strong><br/><input type="password" name="password" value="" class="text"></td>
		<td width="50%"><strong>Password (Confirm)</strong><br/><input type="password" name="password_confirm" value="" class="text"></td>
	</tr>
	</table>
<br/>
	<table border="0" cellspacing="0" cellpadding="0" class="edit-form">
	<tr>
		<td><strong>Date of Birth (<a style="vertical-align: middle" href="javascript:void(0)" onclick="popUpCalendar(this, document.getElementById('date'), '<?=DATE_JS_CALENDAR?>')">Calendar</a>)</strong><br/>
			<input type="text" name="birthdate" id="date" value="<?=$_POST['birthdate']?>" class="text"></td>
		<td><strong>Last&nbsp;Name:<br/><input type="text" name="lastname" value="<?=$_POST['lastname']?>" class="text"></td>
		<td><strong>First Name</strong><br/><input type="text" name="firstname" value="<?=$_POST['firstname']?>" class="text"></td>
	</tr>
	</table>
	<div class="edit-form">
		<strong>Role</strong><br/><input type="text" class="text" value="<?=$_POST['role']?>" name="role">
	</div>
	<div class="edit-form">
		<strong>Equipment</strong><br/><textarea id="equipment" class="mid" name="equipment"><?=$_POST['equipment']?></textarea>
	</div>
	<div class="edit-form">
		<strong><strong>Influences</strong><br/><textarea class="mid" id="influences" name="influences"><?=$_POST['influences']?></textarea>
	</div>
	<div class="edit-form">
		<strong>Bio</strong><br/><textarea class="full" id="bio" name="bio"><?=$_POST['bio']?></textarea>
	</div>
	
	<div class="edit-form">
		<input type="submit" value="Add Member" name="submit" class="button">
		<input type="submit" value="Exit Without Updating" name="preview" onclick="location.href='band_members.php'; return false" class="button">
	</div>
	
<? } ?>

<? include('layout/footer.php'); ?>
